HOME |  BACK |  NEXT |  _  WORDLIST |  TOPICS |  _  AUTHORS |  E-MAIL |  _  INDEX | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

WWWE LogoTopic:

<TABLE> Table

Definition:

The HTML table model has been chosen for its simplicity and flexibility. By default the table is automatically sized according to the cell contents and the current window size. The COLSPEC attribute can be used when needed to exert control over column widths, either by setting explicit widths or by specifying relative widths. You can also specify the table width explicitly or as a fraction of the current margins (see WIDTH attribute).

Table start with an optional caption followed one or more rows. Each row is formed by one or more cells, which are differentiated into header and data cells. Cells can be merged across rows and columns, and include attributes assisting rendering to speech and braille, or for exporting table data into databases. The model provides little direct support for control over appearence, for example border styles and margins, as these can be handled via subclassing and associated style sheets.

Tables can contain a wide range of content, such as headers, lists, paragraphs, forms, figures, preformatted text and even nested tables. When the table is flush left or right, subsequent elements will be flowed around the table if there is sufficient room. This behaviour is disabled when the noflow attribute is given or the table align attribute is center (the default), or justify.

Attributes:

ID
An SGML identifier used as the target for hypertext links or for naming particular elements in associated style sheets. Identifiers are NAME tokens and must be unique within the scope of the current document.

LANG
This is one of the ISO standard language abbreviations, e.g. "en.uk" for the variety of English spoken in the United Kingdom. It can be used by parsers to select language specific choices for quotation marks, ligatures and hyphenation rules. The language attribute is composed from the two letter language code from ISO 639, optionally followed by a period and a two letter country code from ISO 3166.

CLASS
This a space separated list of SGML NAME tokens and is used to subclass tag names. By convention, class names are interpreted hierarchically, with the most general class on the left and the most specific on the right, where classes are separated by a period. The CLASS attribute is most commonly used to attach a different style to some element, but it is recommended that where practical class names should be picked on the basis of the element's semantics, because this permitsother uses, such as restricting search through documents by matching on element class names. The conventions for choosing class names are outside the scope of this document.

CLEAR
When there is a figure or another table in the margin, you sometimes want to start another table below the figure rather than alongside it. The CLEAR attribute allows you to move down unconditionally:

clear=left
move down until left margin is clear
clear=right
move down until right margin is clear
clear=all
move down until both margins are clear

Alternatively, you can decide to place the table alongside the figure just so long as there is enough room. The minimum width needed is specified as:
clear="40 en"
move down until there is at least 40 en units free
clear="100 pixels"
move down until there is at least 100 pixels free

The style sheet (or browser defaults) may provide default minimum widths for each class of block- like elements.

NOFLOW
The presence of this attribute disables text flow around the table. It avoids the need to use the CLEAR or NEEDS attributes on the following element.

ALIGN
Specifies horizontal alignment of the table (not its contents):

BLEEDLEFT
Flush left with the left (window) border.
LEFT
Flush left with the left text margin.
CENTER
The table is centered between the text margins and text flow around the table is disabled. This is the default setting for ALIGN.
RIGHT
Flush right with the right text margin.
BLEEDRIGHT
Flush right with the right (window) border
JUSTIFY
When applicable the table should be sized to fill the space between the left and right text margins. Text flow around the table is disabled for align=justify.

UNITS
Specifies the choice of units for the COLSPEC attribute:

units=en
Specifies en units (a typographical unit equalt to half the point size). This is the default setting and allows user agents to render the table a row at a time without waiting until all of the table's data has been received.
units=relative
Used to set the relative width of columns. The user agent sums the values to determine the proportional width of each column.
units=pixels
The least useful!

A design issue for user agents is how to handle cases where cell contents won't fit into the specified column widths. One approach is to clip the contents to the given column width, another is to resize the columns to fit the contents regardless of the COLSPEC attribute (its best to wait until all of the table's data has been processed before resizing).

COLSPEC
The colspec attribute is a list of column widths and alignment specifications. The columns are listed from left to right with a capital letter followed by a number, e.g. COLSPEC="L20 C8 L40". The letter is L for left, C for center, R for right alignment of cell contents. J is for justification, when feasible, otherwise this is treated in the same way as L for left alignment. D is for decimal alignment, see DP attribute.
Capital letters are required to avoid a particularly common error when a lower case L is confused with a one. Column entries are delimited by one or more space characters.
The number specifies the width in en's, pixels or as a fractional value of the table width, as according to the associated units attribute. This approach is more compact than used with most SGML table models and chosen to simplify hand entry. The width attribute allows you to specify the width of the table in pixels, em units or as a percentage of the space between the current left and right margins.

DP
This specifies the character to be used for the decimal point with the COLSPEC attribute, e.g. dp="." (the default) or dp=",". The default may be altered by the language context, as set by the LANG attribute on enclosing elements.

WIDTH
This specifies the width of the table according to the UNITS attribute. If units=relative, the width is taken as a percentage of the width between the current left and right margins. The user agent should disregard this attribute if it would result in columns having less than their minimum widths.

BORDER
This presence of this attribute instructs the user agent to render borders around tables. For instance: <TABLE BORDER>. The precise appearence, along with the size of margins around cells, can be controlled by associated style sheets, or via information in the STYLE element in the document head. Subclassing tables, rows and cells is particularly useful in this regard.

NOWRAP
The NOWRAP attribute is used when you don't want the browser to automatically wrap lines. You can then explicitly specify line breaks in paragrphs using the BR element.

Context:

<TABLE> is legal within:
<BANNER>, <BODYTEXT>, <DD>, <DIV>, <FIGTEXT>, <FN>, <FORM>, <LI>, <NOTE>, <TD>, <TH>

The following markup can be used within <TABLE>
<CAPTION>, <TR>

Suggested style/usage:

Close Tag: REQUIRED

There are several points to note:

By default, header cells are centered while data cells are flush left. This can be overriden by the ALIGN attribute for the cell; the COLSPEC attribute for the TABLE element; or the ALIGN attribute on the enclosing row's TR element (from the most specific to the least).

Example:

<TABLE>
<CAPTION>A nice table</CAPTION>
<TR><TH>This</TH><TH>That</TH></TR>
<TR><TD>1</TD><TD>2</TD></TR>
</TABLE>

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

E-Mail: The World Wide Web Encyclopedia at wwwe@tab.com
E-Mail: Charles River Media at chrivmedia@aol.com
Copyright 1996 Charles River Media. All rights reserved.
Text - Copyright © 1995, 1996 - James Michael Stewart & Ed Tittel.
Web Layout - Copyright © 1995, 1996 - LANWrights & IMPACT Online.
Revised -- February 20th, 1996